<template>
  <el-dialog
    :title="title"
    width="1200%"
    :close-on-click-modal="false"
     v-dialogDrag
    :visible.sync="visible">
    <el-form :model="inputForm" ref="inputForm" :class="method==='view'?'readonly':''"  :disabled="method==='view'" @keyup.enter.native="doSubmit()"
             label-width="120px">
      <el-row  :gutter="20">
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="犯罪嫌疑人供述" prop="one"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">犯罪嫌疑人供述</div>
                      <el-select v-model="inputForm.one" placeholder="请选择">
                                                              <el-option
                                                                v-for="item in $dictUtils.getDictList('danxuan')"
                                                                :key="item.value"
                                                                :label="item.label"
                                                                :value="item.value">
                                                              </el-option>
                                                            </el-select>

                      </el-radio-group>
                    <el-input v-model="inputForm.jput" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="血样提取登记表、鉴定意见" prop="twoId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">血样提取登记表、鉴定意见</div>
                     <el-select v-model="inputForm.twoId" placeholder="请选择">
                                                             <el-option
                                                               v-for="item in $dictUtils.getDictList('danxuan')"
                                                               :key="item.value"
                                                               :label="item.label"
                                                               :value="item.value">
                                                             </el-option>
                                                           </el-select>

                     </el-radio-group>
                    <el-input v-model="inputForm.jputone" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="吸毒现场检测报告书" prop="threeId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">吸毒现场检测报告书</div>
                   <el-select v-model="inputForm.threeId" placeholder="请选择">
                                                           <el-option
                                                             v-for="item in $dictUtils.getDictList('danxuan')"
                                                             :key="item.value"
                                                             :label="item.label"
                                                             :value="item.value">
                                                           </el-option>
                                                         </el-select>

                   </el-radio-group>
                    <el-input v-model="inputForm.jputtwo" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="道路交通事故认定书" prop="fourId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">道路交通事故认定书</div>
                    <el-radio-group v-model="inputForm.fourId">
                     <el-select v-model="inputForm.fourId" placeholder="请选择">
                                                             <el-option
                                                               v-for="item in $dictUtils.getDictList('danxuan')"
                                                               :key="item.value"
                                                               :label="item.label"
                                                               :value="item.value">
                                                             </el-option>
                                                           </el-select>

                     </el-radio-group>
                    <el-input v-model="inputForm.jputthree" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="行政强制措施凭证" prop="fiveId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">行政强制措施凭证</div>
                     <el-select v-model="inputForm.fiveId" placeholder="请选择">
                                                             <el-option
                                                               v-for="item in $dictUtils.getDictList('danxuan')"
                                                               :key="item.value"
                                                               :label="item.label"
                                                               :value="item.value">
                                                             </el-option>
                                                           </el-select>

                     </el-radio-group>
                    <el-input v-model="inputForm.jputfour" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="行政处罚 决定书" prop="sixId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">行政处罚 决定书</div>
                  <el-select v-model="inputForm.sixId" placeholder="请选择">
                                                          <el-option
                                                            v-for="item in $dictUtils.getDictList('danxuan')"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                          </el-option>
                                                        </el-select>

                  </el-radio-group>
                    <el-input v-model="inputForm.jputfive" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
            <!-- <el-form-item label="驾驶人信息查询结果单、驾驶证复印件" prop="selvenId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">驾驶人信息查询结果单、驾驶证复印件</div>
                    <el-select v-model="inputForm.selvenId" placeholder="请选择">
                                                            <el-option
                                                              v-for="item in $dictUtils.getDictList('danxuan')"
                                                              :key="item.value"
                                                              :label="item.label"
                                                              :value="item.value">
                                                            </el-option>
                                                          </el-select>

                    </el-radio-group>
                    <el-input v-model="inputForm.jputsix" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="机动车信息查询结果单、行驶证复印件" prop="eightId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">机动车信息查询结果单、行驶证复印件</div>
                   <el-select v-model="inputForm.eightId" placeholder="请选择">
                                                           <el-option
                                                             v-for="item in $dictUtils.getDictList('danxuan')"
                                                             :key="item.value"
                                                             :label="item.label"
                                                             :value="item.value">
                                                           </el-option>
                                                         </el-select>

                   </el-radio-group>
                    <el-input v-model="inputForm.jputselven" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="赔偿谅解 协议" prop="nineId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">赔偿谅解 协议</div>
                    <el-select v-model="inputForm.nineId" placeholder="请选择">
                                                            <el-option
                                                              v-for="item in $dictUtils.getDictList('danxuan')"
                                                              :key="item.value"
                                                              :label="item.label"
                                                              :value="item.value">
                                                            </el-option>
                                                          </el-select>

                    </el-radio-group>
                    <el-input v-model="inputForm.jputeight" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
            <!-- <el-form-item label="犯罪嫌疑人户籍材料" prop="tenId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">犯罪嫌疑人户籍材料</div>
                      <el-select v-model="inputForm.tenId" placeholder="请选择">
                                                              <el-option
                                                                v-for="item in $dictUtils.getDictList('danxuan')"
                                                                :key="item.value"
                                                                :label="item.label"
                                                                :value="item.value">
                                                              </el-option>
                                                            </el-select>

                      </el-radio-group>
                    <el-input v-model="inputForm.jputnine" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
          <!--  <el-form-item label="犯罪记录 调查证明" prop="elevenId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">犯罪记录 调查证明</div>
                        <el-select v-model="inputForm.elevenId" placeholder="请选择">
                                                                <el-option
                                                                  v-for="item in $dictUtils.getDictList('danxuan')"
                                                                  :key="item.value"
                                                                  :label="item.label"
                                                                  :value="item.value">
                                                                </el-option>
                                                              </el-select>

                        </el-radio-group>
                    <el-input v-model="inputForm.jputten" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="前科材料" prop="twelve"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">前科材料</div>
                    <el-select v-model="inputForm.twelve" placeholder="请选择">
                                                            <el-option
                                                              v-for="item in $dictUtils.getDictList('danxuan')"
                                                              :key="item.value"
                                                              :label="item.label"
                                                              :value="item.value">
                                                            </el-option>
                                                          </el-select>

                    </el-radio-group>
                    <el-input v-model="inputForm.jputeleven" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
         <!--   <el-form-item label="发破案经过" prop="thirtyId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">发破案经过</div>
                    <el-select v-model="inputForm.thirtyId" placeholder="请选择">
                                                            <el-option
                                                              v-for="item in $dictUtils.getDictList('danxuan')"
                                                              :key="item.value"
                                                              :label="item.label"
                                                              :value="item.value">
                                                            </el-option>
                                                          </el-select>

                    </el-radio-group>
                    <el-input v-model="inputForm.jputtwelve" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
        <!--    <el-form-item label="抓获经过" prop="fouurteenId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">抓获经过</div>
                   <el-select v-model="inputForm.fouurteenId" placeholder="请选择">
                                                           <el-option
                                                             v-for="item in $dictUtils.getDictList('danxuan')"
                                                             :key="item.value"
                                                             :label="item.label"
                                                             :value="item.value">
                                                           </el-option>
                                                         </el-select>

                   </el-radio-group>
                    <el-input v-model="inputForm.jputthirteen" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
        <!--    <el-form-item label="证人证言" prop="fiveteenId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">证人证言</div>
                     <el-select v-model="inputForm.fiveteenId" placeholder="请选择">
                                                             <el-option
                                                               v-for="item in $dictUtils.getDictList('danxuan')"
                                                               :key="item.value"
                                                               :label="item.label"
                                                               :value="item.value">
                                                             </el-option>
                                                           </el-select>

                     </el-radio-group>
                    <el-input v-model="inputForm.jputfourteen" ></el-input>
        </el-col>
        <el-col style="margin-top: 10px;">
           <!-- <el-form-item label="其他证据" prop="oneId"
                :rules="[
                 ]">
           </el-form-item> -->
                      <div style="text-align: left;">其他证据</div>
                     <el-select v-model="inputForm.oneId" placeholder="请选择">
                                                             <el-option
                                                               v-for="item in $dictUtils.getDictList('danxuan')"
                                                               :key="item.value"
                                                               :label="item.label"
                                                               :value="item.value">
                                                             </el-option>
                                                           </el-select>

                     </el-radio-group>
                    <el-input v-model="inputForm.jputfiveteen" ></el-input>
        </el-col>
        </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">关闭</el-button>
      <el-button v-if="method !== 'view'" type="primary" @click="doSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        title: '',
        method: '',
        visible: false,
        oldInputForm: '',
        inputForm: {
          id: '',
          jput: '',
          jputone: '',
          jputtwo: '',
          jputthree: '',
          jputfour: '',
          jputfive: '',
          jputsix: '',
          jputselven: '',
          jputeight: '',
          jputnine: '',
          jputten: '',
          jputeleven: '',
          jputtwelve: '',
          jputthirteen: '',
          jputfourteen: '',
          jputfiveteen: '',
          testDataMain: {
            id: ''
          },
          one: '',
          twoId: '',
          threeId: '',
          fourId: '',
          fiveId: '',
          sixId: '',
          selvenId: '',
          eightId: '',
          nineId: '',
          tenId: '',
          elevenId: '',
          twelve: '',
          thirtyId: '',
          fouurteenId: '',
          fiveteenId: '',
          oneId: '',
          remarks: ''
        }
      }
    },
    components: {
    },
    watch: {
      // 路径改变时候 关闭组件bug
      $route (newVal, oldVal) {
        this.visible = false
      }
    },
    methods: {
      init (method, obj) {
        this.method = method
        if (method === 'add') {
          this.title = `新建危险驾驶罪证据指引`
        } else if (method === 'edit') {
          this.title = '修改危险驾驶罪证据指引'
        } else if (method === 'view') {
          this.title = '查看危险驾驶罪证据指引'
        }
        this.visible = true
        this.$nextTick(() => {
          this.$refs.inputForm.resetFields()
          this.inputForm.id = ''
          this.oldInputForm = ''
          if (method === 'edit' || method === 'view') { // 修改或者查看
            this.oldInputForm = obj
            this.inputForm = JSON.parse(JSON.stringify(obj))
          }
        })
      },
   // 表单提交
      doSubmit () {
        this.$refs['inputForm'].validate((valid) => {
          if (valid) {
            this.$emit('addRow', this.oldInputForm, JSON.parse(JSON.stringify(this.inputForm)))
       if ((this.inputForm.one === '1' | this.inputForm.jput !== '') & (this.inputForm.twoId === '1' | this.inputForm.jputone !== '') & (this.inputForm.threeId === '1' | this.inputForm.jputtwo !== '') & (this.inputForm.fourId === '1' | this.inputForm.jputthree !== '') & (this.inputForm.fiveId === '1' | this.inputForm.jputfour !== '') & (this.inputForm.sixId === '1' | this.inputForm.jputfive !== '') & (this.inputForm.selvenId === '1' | this.inputForm.jputsix !== '') & (this.inputForm.eightId === '1' | this.inputForm.jputselven !== '') & (this.inputForm.nineId === '1' | this.inputForm.jputeight !== '') & (this.inputForm.tenId === '1' | this.inputForm.jputnine !== '') & (this.inputForm.elevenId === '1' | this.inputForm.jputten !== '') & (this.inputForm.twelve === '1' | this.inputForm.jputeleven !== '') & (this.inputForm.thirtyId === '1' | this.inputForm.jputtwelve !== '') & (this.inputForm.fouurteenId === '1' | this.inputForm.jputthirteen !== '') & (this.inputForm.fiveteenId === '1' | this.inputForm.jputfourteen !== '') & (this.inputForm.oneId === '1' | this.inputForm.jputfiveteen !== '')) {
         this.$emit('axx', '齐全')
       } else if (((this.inputForm.one === '' | this.inputForm.one === '2') & this.inputForm.jput === '') | ((this.inputForm.twoId === '' | this.inputForm.twoId === '2') & this.inputForm.jputone === '') | ((this.inputForm.threeId === '' | this.inputForm.threeId === '2') & this.inputForm.jputtwo === '') | ((this.inputForm.fourId === '' | this.inputForm.fourId === '2') & this.inputForm.jputthree === '') | ((this.inputForm.fiveId === '' | this.inputForm.fiveId === '2') & this.inputForm.jputfour === '') | ((this.inputForm.sixId === '' | this.inputForm.sixId === '2') & this.inputForm.jputfive === '') | ((this.inputForm.selvenId === '' | this.inputForm.selvenId === '2') & this.inputForm.jputsix === '') | ((this.inputForm.eightId === '' | this.inputForm.eightId === '2') & this.inputForm.jputselven === '') | ((this.inputForm.nineId === '' | this.inputForm.nineId === '2') & this.inputForm.jputeight === '') | ((this.inputForm.tenId === '' | this.inputForm.tenId === '2') & this.inputForm.jputnine === '') | ((this.inputForm.elevenId === '' | this.inputForm.elevenId === '2') & this.inputForm.jputten === '') | ((this.inputForm.twelve === '' | this.inputForm.twelve === '2') & this.inputForm.jputeleven === '') | ((this.inputForm.thirtyId === '' | this.inputForm.thirtyId === '2') & this.inputForm.jputtwelve === '') | ((this.inputForm.fouurteenId === '' | this.inputForm.fouurteenId === '2') & this.inputForm.jputthirteen === '') | ((this.inputForm.fiveteenId === '' | this.inputForm.fiveteenId === '2') & this.inputForm.jputfourteen === '') | ((this.inputForm.oneId === '' | this.inputForm.oneId === '2') & this.inputForm.jputfiveteen === '')) {
     this.$emit('axx', '不齐全')
       }
            this.visible = false
          }
        })
        this.$emit('values', 1)
      },
      continueDoSubmit () {
        this.$refs['inputForm'].validate((valid) => {
          if (valid) {
            this.$emit('addRow', this.oldInputForm, JSON.parse(JSON.stringify(this.inputForm)))
       if ((this.inputForm.one === '1' | this.inputForm.jput !== '') & (this.inputForm.twoId === '1' | this.inputForm.jputone !== '') & (this.inputForm.threeId === '1' | this.inputForm.jputtwo !== '') & (this.inputForm.fourId === '1' | this.inputForm.jputthree !== '') & (this.inputForm.fiveId === '1' | this.inputForm.jputfour !== '') & (this.inputForm.sixId === '1' | this.inputForm.jputfive !== '') & (this.inputForm.selvenId === '1' | this.inputForm.jputsix !== '') & (this.inputForm.eightId === '1' | this.inputForm.jputselven !== '') & (this.inputForm.nineId === '1' | this.inputForm.jputeight !== '') & (this.inputForm.tenId === '1' | this.inputForm.jputnine !== '') & (this.inputForm.elevenId === '1' | this.inputForm.jputten !== '') & (this.inputForm.twelve === '1' | this.inputForm.jputeleven !== '') & (this.inputForm.thirtyId === '1' | this.inputForm.jputtwelve !== '') & (this.inputForm.fouurteenId === '1' | this.inputForm.jputthirteen !== '') & (this.inputForm.fiveteenId === '1' | this.inputForm.jputfourteen !== '') & (this.inputForm.oneId === '1' | this.inputForm.jputfiveteen !== '')) {
         this.$emit('axx', '齐全')
       } else if (((this.inputForm.one === '' | this.inputForm.one === '2') & this.inputForm.jput === '') | ((this.inputForm.twoId === '' | this.inputForm.twoId === '2') & this.inputForm.jputone === '') | ((this.inputForm.threeId === '' | this.inputForm.threeId === '2') & this.inputForm.jputtwo === '') | ((this.inputForm.fourId === '' | this.inputForm.fourId === '2') & this.inputForm.jputthree === '') | ((this.inputForm.fiveId === '' | this.inputForm.fiveId === '2') & this.inputForm.jputfour === '') | ((this.inputForm.sixId === '' | this.inputForm.sixId === '2') & this.inputForm.jputfive === '') | ((this.inputForm.selvenId === '' | this.inputForm.selvenId === '2') & this.inputForm.jputsix === '') | ((this.inputForm.eightId === '' | this.inputForm.eightId === '2') & this.inputForm.jputselven === '') | ((this.inputForm.nineId === '' | this.inputForm.nineId === '2') & this.inputForm.jputeight === '') | ((this.inputForm.tenId === '' | this.inputForm.tenId === '2') & this.inputForm.jputnine === '') | ((this.inputForm.elevenId === '' | this.inputForm.elevenId === '2') & this.inputForm.jputten === '') | ((this.inputForm.twelve === '' | this.inputForm.twelve === '2') & this.inputForm.jputeleven === '') | ((this.inputForm.thirtyId === '' | this.inputForm.thirtyId === '2') & this.inputForm.jputtwelve === '') | ((this.inputForm.fouurteenId === '' | this.inputForm.fouurteenId === '2') & this.inputForm.jputthirteen === '') | ((this.inputForm.fiveteenId === '' | this.inputForm.fiveteenId === '2') & this.inputForm.jputfourteen === '') | ((this.inputForm.oneId === '' | this.inputForm.oneId === '2') & this.inputForm.jputfiveteen === '')) {
     this.$emit('axx', '不齐全')
       }
            this.$refs['inputForm'].resetFields()
          }
        })
      }
    }
  }
</script>
